import {
    onMounted,
    reactive,
    onBeforeUnmount
} from "vue";


export default function () {
    const pointCoordinate = reactive({
        x: 0,
        y: 0,
    });

    function savePoint(e) {
        pointCoordinate.x = e.pageX;
        pointCoordinate.y = e.pageY;
        console.log(111);
    }

    onMounted(() => {
        window.addEventListener("click", savePoint);
    });
    onBeforeUnmount(() => {
        window.removeEventListener("click", savePoint);
    });

    return pointCoordinate
}